@extends("/main_template",title="产品类别列表")
@import com.mgfireworks.mgplatform.mgadmin.product.model.Category
@import cn.hn.java.summer.utils.JsonUtils
@args List<Category> categoryList
	<s_panel>
		
		<s_buttons slot="button" cols="3">
		<s_button type="link" icon="fa-plus" href="@url("add.html?parentId={0}")">添加</s_button>
		<s_button type="link" icon="fa-pencil" href="@url("edit.html?cateId={0}")">修改</s_button>
		<s_button type="del" href="@url("del.json?cateId={0}")">删除</s_button>
	</s_buttons>
	</s_panel>

	<div class="row jsAutoCheckRow">
		<div class="col-sm-12">
			<div id="jsProductCateTree"></div>
		</div>
	</div>
		
    @section(script){
   <script type="text/javascript">
       $(function(){
		 var cateList=JSON.parse('@JsonUtils.toJson(categoryList)');
		 //生成类别树数据
		 var cateTree=util.el.genTreeData({
			 data:cateList,
			 rootText:"所有类别",
			 rootValue:"",
			 dataParentId:"parentId",
			 dataTextName:"cateName",
			 dataValueName:"cateId"
		 });

		   $("#jsProductCateTree").treeview({
			   depth: 2,
			   textName: "cateName",
			   valueName: "cateId",
			   selectedValue: "",
			   remote: "list.json?parentId={0}",
			   data: cateTree,
			   selectedNodeId:$("#jsCateId").val()
		   });

       });

   </script>
       
    }
